﻿using Framework.Core;
using Framework.Core.Io;
using Framework.Remoting.Client;
using Framework.Remoting.Conventions;
using Framework.Tests.Wcf.Client.ServiceDefinition;
using Xunit;

namespace Framework.Tests.Wcf.Client
{
    public class WcfInterceptorFactoryTest
    {
        private readonly IWcfInterceptorFactory target;

        public WcfInterceptorFactoryTest()
        {
            target = new WcfInterceptorFactory(new ChannelPerRequest(new CachedChannelFactoryFactory()),
                new WcfServiceInfoFactory(new ConfigurationManagerAdapter(), new BindingFactory(), new ProtocolFactory()));
        }

        [Fact]
        public void When_create_interceptor_expected_wcf_interceptor()
        {
            var actual = target.Create<IContract>(EnvMode.Prod);
            Assert.NotNull(actual);
            Assert.True(actual is WcfInterceptor<IContract>);
        }
    }
}